/*
 * @Author: New Name 1278138741@qq.com
 * @Date: 2024-12-10 16:06:11
 * @LastEditors: New Name 1278138741@qq.com
 * @LastEditTime: 2024-12-22 00:05:19
 * @FilePath: \stray animals\src\router\index.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { createRouter, createWebHistory } from "vue-router";
import HomeView from "../views/home/HomeView.vue";
import ContactView from "../views/contact/ContactView.vue";
import JoinView from "../views/join/JoinView.vue";
import LoginView from "../views/login/LoginView.vue";
import Donation from "../views/donation/DonationView.vue";
import Update from "../views/updata/Update.vue";
import AdoptDog from "../views/adoipt/AdoptDog.vue";
import AdoptCat from "../views/adoipt/AdoptCat.vue";
import AdoptOther from "../views/adoipt/AdoptOther.vue";
import Detail from "../views/Detail.vue";
import SeachCat from "../views/seach/SeachCat.vue";
import SeachDog from "../views/seach/SeachDog.vue";
import SeachOther from "../views/seach/SeachOther.vue";
import ArticlesOther from "../views/articles/ArticlesOther.vue";
import ArticlesDog from "../views/articles/ArticlesDog.vue";
import ArticlesCat from "../views/articles/ArticlesCat.vue";
import Search from "../views/seach/Search.vue";
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {path: "/",redirect: "/login",},
    {path: "/home",name: "home",component: HomeView,meta: { title: "Home" },},
    {path: "/contact",name: "contact",component: ContactView,meta: { title: "Contact" },},
    {
      path: "/join",
      name: "join",
      component: JoinView,
      meta: { title: "Join" },
    },
    {
      path: "/login",
      name: "login",
      component: LoginView,
      meta: { title: "Login" },
    },
    {
      path: "/donation",
      name: "donation",
      component: Donation,
      meta: { title: "Donation" },
    },
    {
      path: "/update",
      name: "update",
      component: Update,
      meta: { title: "Update" },
    },
    {
      path: "/adoptdog",
      name: "adoptdog",
      component: AdoptDog,
      meta: { title: "AdoptDog" },
    },
    {
      path: "/adoptcat",
      name: "adoptcat",
      component: AdoptCat,
      meta: { title: "AdoptCat" },
    },
    {
      path: "/adoptother",
      name: "adoptother",
      component: AdoptOther,
      meta: { title: "AdoptOther" },
    },
    {
      path: "/seachdog",
      name: "seachdog",
      component: SeachDog,
      meta: { title: "SeachDog" },
    },
    {
      path: "/seachcat",
      name: "seachcat",
      component: SeachCat,
      meta: { title: "SeachCat" },
    },
    {
      path: "/seachother",
      name: "seachother",
      component: SeachOther,
      meta: { title: "SeachOther" },
    },
    {
      path: "/articlescat",
      name: "articlescat",
      component: ArticlesCat,
      meta: { title: "ArticlesCat" },
    },
    {
      path: "/articlesdog",
      name: "articlesdog",
      component: ArticlesDog,
      meta: { title: "ArticlesDog" },
    },
    {
      path: "/articlesother",
      name: "articlesother",
      component: ArticlesOther,
      meta: { title: "ArticlesOther" },
    },
    {
      path: "/detail/:id",
      name: "Detail",
      component: Detail,
      meta: { title: "Detail" },
    },
    {
      path: "/seach",
      name: "seach",
      component: Search,
      meta: { title: "Search" },
    },
  ],
});

// Add a global navigation guard to set the document title
router.beforeEach((to, from, next) => {
  document.title = to.meta.title || "Default Title";
  next();
});

export default router;
